package com.tg.app.camera;

import com.tg.appcommon.android.Packet;

/**
 * 行车记录仪灵敏度
 *
 * 注意 读写的时候，需要根据 scene 分场景
 */
public interface TciCmdParking {
    int TCI_CMD_SET_PARKING_DET  = 0x0364; ///< 设置g-sensor配置
    int TCI_CMD_GET_PARKING_DET = 0x0366; ///< 获取g-sensor配置
    int TCI_CMD_GET_PARKING_DET_RESP = 0x0367;

    int TCI_CMD_SET_PARKING_MONITOR = 0x0484;
    int TCI_CMD_GET_PARKING_MONITOR = 0x0486;
    int TCI_CMD_GET_PARKING_MONITOR_RESP = 0x0487;


    int GSENSOR_SCENE_DRIVING = 0; // 车辆运行中
    int GSENSOR_SCENE_PARKING = 1; // 停车状态

    static byte[] parseRespContent(int type, int scene) {

        byte[] result = new byte[8];
        byte[] typeByte = Packet.intToByteArray_Little(type);
        byte[] sceneByte = Packet.intToByteArray_Little(scene);
        System.arraycopy(typeByte, 0, result, 0, 4);
        System.arraycopy(sceneByte, 0, result, 4, 4);
        return result;
    }

    static byte[] parseReqContent() {

        byte[] result = new byte[4];
        byte[] sceneByte = Packet.intToByteArray_Little(0);
        System.arraycopy(sceneByte, 0, result, 0, 4);
        return result;
    }

    static byte[] parseParkingMonitorSwitch(int enabled){
        byte[] result = new byte[4];
        byte[] sceneByte = Packet.intToByteArray_Little(enabled);
        System.arraycopy(sceneByte, 0, result, 0, 4);
        return result;
    }

    static byte[] parseParkingEdt(int flags, int sensitivity, int workTime){
        byte[] result = new byte[16];
        byte[] f = Packet.intToByteArray_Little(flags);
        byte[] s = Packet.intToByteArray_Little(sensitivity);
        byte[] w = Packet.intToByteArray_Little(workTime);
        System.arraycopy(f, 0, result, 4, 4);
        System.arraycopy(s, 0, result, 8, 4);
        System.arraycopy(w, 0, result, 12, 4);
        return result;
    }
}
